#ifndef ____AppleHIDConverter__
#define ____AppleHIDConverter__


#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

#define HID_USAGE_PAGE_TELEPHONY 0x0B
#define HID_USAGE_PHONE 0x01
#define HID_USAGE_HOOK_SWITCH 0x20
#define HID_USAGE_FLASH 0x21
#define HID_USAGE_DROP 0x26

typedef struct {
    uint8_t usagePage;
    uint8_t usage;
    uint8_t reportOffset;  // 位偏移
    uint8_t reportSize;    // 位大小
    uint8_t enable;        // 是否使用( 1 )
} HIDUsageDescriptor;

typedef struct {
    HIDUsageDescriptor hookSwitch;
    HIDUsageDescriptor flash;
    HIDUsageDescriptor drop;
    uint8_t reportByteLength;  // 报告的字节长度
} HIDReportDescriptor;

void parseHIDDescriptor(const uint8_t *desc, size_t descSize, HIDReportDescriptor *reportDescriptor);

void parseHIDReport(const HIDReportDescriptor *reportDescriptor, const uint8_t *report,void (*pFunc)(int keyCode));

int AppleHidTest();

#ifdef __cplusplus
}
#endif

#endif /* defined(____AppleHIDConverter__) */
